package com.phuonghoang.adapter;

import com.phuonghoang.vnexpress.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CatergoryVnexpressAdapter extends ArrayAdapter<String> {
	private Context context;
	private String[] catergories;
	private int icon;

	public CatergoryVnexpressAdapter(Context context, int icon,
			String[] catergories) {
		super(context, icon, catergories);
		this.context = context;
		this.icon = icon;
		this.catergories = catergories;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		@SuppressWarnings("static-access")
		LayoutInflater layoutInflater = (LayoutInflater) context
				.getSystemService(context.LAYOUT_INFLATER_SERVICE);
		View rowView = layoutInflater.inflate(R.layout.paper_vnexpress, parent,
				false);
		ImageView image = (ImageView) rowView.findViewById(R.id.iConVnexpress);
		TextView text = (TextView) rowView.findViewById(R.id.tvVnexpress);
		image.setImageResource(icon);
		text.setText(catergories[position]);
		return rowView;
	}
}
